//
//  TTRenewalResultViewController.m
//  TaoTuo
//
//  Created by admin on 2019/11/5.
//  Copyright © 2019 admin. All rights reserved.
//

#import "TTRenewalResultViewController.h"

@interface TTRenewalResultViewController ()

@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *backHomeBtn;

@end

@implementation TTRenewalResultViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"支付结果";
    [self setupSubviews];
    
    // 续费成功
    [[NSNotificationCenter defaultCenter] postNotificationName:@"refreashDatas" object:nil];
    
}

- (void)backHomeBtnClick
{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)setupSubviews
{
//    NSString *imageName = YES ? @"paysuccess" : @"payfail";
    NSString *imageName = @"paysuccess";
    UIImage *image = [UIImage imageNamed:imageName];
    _imageView = [[UIImageView alloc] initWithImage:image];
    [self.view addSubview:_imageView];
    [_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(50);
        make.centerX.equalTo(self.view);
    }];
    
//    NSString *title = YES ? @"续费成功" : @"支付失败";
    NSString *title = @"续费成功";
    _titleLabel = [UILabel labelWithTitle:title color:[UIColor blackColor] fontSize:18];
    [self.view addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageView.mas_bottom).mas_offset(20);
        make.centerX.equalTo(self.view);
    }];
    
    _backHomeBtn = [UIButton createButtonWithTitle:@"返回店铺首页" titleColor:[UIColor whiteColor] titleFont:[UIFont systemFontOfSize:18] backgroundColor:kMainColor target:self action:@selector(backHomeBtnClick)];
    _backHomeBtn.layer.cornerRadius = 10;
    [self.view addSubview:_backHomeBtn];
    [_backHomeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).mas_offset(50);
        make.centerX.equalTo(self.view);
        make.left.mas_equalTo(63);
        make.height.mas_equalTo(45);
    }];
    
}


@end
